package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.OverseasBean;
import com.sx.zongzhi.bean.OverseasSearchBean;
import com.sx.zongzhi.modle.CollectManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IOverseasView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *获取境外人员列表
 */
public class OverseasPest {

    private IOverseasView overseasView;

    public OverseasPest(IOverseasView overseasView) {
        this.overseasView=overseasView;
    }


    /**
     *
     * @param orgId 网格id
     * @param page 当前页
     * @param rows 当前行
     */
    public void getOverseasList(String path, String orgId, OverseasSearchBean searchBean, int page, int rows){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("orgId", orgId);
        if (searchBean!=null){
            map.put("searchOverseaPersonnelVo.englishName",searchBean.getEnglishName());
            map.put("searchOverseaPersonnelVo.chineseName", searchBean.getName());
            map.put("searchOverseaPersonnelVo.currentAddress", searchBean.getCurrentAddress());
            map.put("searchOverseaPersonnelVo.gender",searchBean.getGender());
            map.put("searchOverseaPersonnelVo.nationality", searchBean.getNationality());
            map.put("searchOverseaPersonnelVo.inflowReason", searchBean.getInflowReason());
            map.put("searchOverseaPersonnelVo.professionId", searchBean.getProfessionId());
            map.put("searchOverseaPersonnelVo.birthdayStart", searchBean.getBirthday());
            map.put("searchOverseaPersonnelVo.birthdayEnd", searchBean.getEndBirthday());
            map.put("searchOverseaPersonnelVo.certificateStrartDay", searchBean.getCertificateStrartDay());
            map.put("searchOverseaPersonnelVo.certificateEndDay", searchBean.getCertificateEndDay());
            map.put("searchOverseaPersonnelVo.arrivalTimeStart", searchBean.getArrivalTimeStart());
            map.put("searchOverseaPersonnelVo.arrivalTimeEnd", searchBean.getArrivalTimeEnd());
            map.put("searchOverseaPersonnelVo.leaveTimeStart", searchBean.getLeaveTimeStart());
            map.put("searchOverseaPersonnelVo.leaveTimeEnd", searchBean.getLeaveTimeEnd());

        }
        map.put("page", page);
        map.put("rows", rows);
        new CollectManager().getOverseasList(path,map, new BaseCallBack<BaseResult<OverseasBean>>() {
            @Override
            public void onSuccess(BaseResult<OverseasBean> response) {
                overseasView.getOverSeasList(response.getData());
            }
            @Override
            public void onFailures(String message) {
                overseasView.showError(message);
            }
        });
    }


}
